package com.yc.spring;

import com.yc.cinema.bean.User;
import com.yc.cinema.bean.YcUser;
import org.springframework.context.annotation.*;

@Configuration
@ComponentScan("com.yc")
//开启aspect自动代理
@EnableAspectJAutoProxy
//配置类  相当于applicationContext.xml
public class IocConfig {

    @Bean
    @Primary
    User user(){
        User user = new User();
        user.setUsername("yyyl");
        user.setId(45);
        return user;
    }


    @Bean
    YcUser ycUser(){
        YcUser ycUser = YcUser.getYcUser();
        return ycUser;
    }


    @Bean
    YcUser ycUser1(){
        User user = new User();
        YcUser factoryYcUser = user.getFactoryYcUser();
        return factoryYcUser;
    }




}
